'''
    1.接口自动化
        requests

        1.导包
        接口框架：
        1.from  selenium  import  webdriver                       import requests
        2.driver.find_element().send_keys()  操作                  session.get()  .post()  用具体的get或者post访问
        3.result =  driver.find_element().text                    result = response.text 取出响应报文
        4.self.assertEquals(result,expect)                        self.assertEquals(result,expect)`
'''

import  requests
# cookie : session
session = requests.session()  #  后面所有的请求都要依赖这个数据

############ 1.登陆
url = "http://localhost:90" #  全局url地址

login_path = "/login/verifyLogin"

param = {
    "username":"jason1",
    "password":"e10adc3949ba59abbe56e057f20f883e"
}

response = session.get(url = url + login_path, params = param)

response.encoding = "utf-8"

print("状态码为：",response.status_code)
print(response.text)

######################## 买入理财

buy_path = "/user/userBuyChangeMoney"

buy_param = {
    "changeMoneyId":"1",
    "userId":"1",
    "passWord":"666666"
}

buy_resp = session.post(url = url +  buy_path, data = buy_param)

####
buy_resp.encoding = "utf-8"

print(buy_resp.status_code)
print(buy_resp.text)


















































































